﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Design Pattern</title>
    <meta name="language" content="en" />    
    <!--myInjectedScript-->

    <!--<link href="C:\Sandbox\Designpatterns\Misc\TemplateLibrary/shared/css/Site.css" rel="stylesheet" />
    <link href="C:\Sandbox\Designpatterns\Misc\TemplateLibrary/shared/css/custom-theme/jquery-ui.custom.css" rel="stylesheet" />

    <script src="C:\Sandbox\Designpatterns\Misc\TemplateLibrary/shared/js/jquery.js"></script>
    
    <script>
        $(function (){
            $("a[href='']").click(function(e) { 
                e.preventDefault();window.external.ClientCallback($(this).text()); });
        });
        
        function CreateCollapsableTopics(){
        
            $('.section').each(function () { 
           
                var text = $('h2', this).text();
                $('h2', this).remove();//replace the header with a widget
                $('<div class="ui-widget-header" style="width:auto">' + text + '</div>')
                .insertBefore(this).click(function () {$(this).next().slideToggle(200);})
                .mouseover(function () {$(this).css('cursor', 'pointer');})
                .next().hide();}); }
       
        
        function DisablePatternLinks(){
        
            $("a[href='']") .each(function(){ 
              
               
                    var txt =$(this).text();

                    $(this).replaceWith(function(){ return  txt ;});    
                });}
        
        
	    function ChangeAppearance(action, target) {
	    
            if(target == 'none')
                return;
            else{ CreateCollapsableTopics();}
            
               
            
		    if(target == 'first') {
		   
		        if(action == 'hide')
				    $('.section:first').hide();		    
		        else
				    $('.section:first').show();}
		    
		    else if(target == 'last') {
		   
	            if(action == 'hide')
			        $('.section:last').hide();		    
	            else
			        $('.section:last').show();}	 else				
	        
		   
		    {$('.section').each(function () { 
			    
			   
				    if(action == 'hide')
					    $(this).hide();
				    else
					    $(this).show(); });} } 
    </script>     
-->
  </head>
  <body>
  <div id="accordion">
    <h1>
      Abstract factory
    </h1>
    <div class="section">
      <h2>
        Intent
      </h2>
      <p>
        Provide an interface for creating families of related or dependent objects without
        specifying their concrete classes.<br />
        </p>
    </div>
    <div class="section">
      <h2>
        Also known as
      </h2>
      <p>
        Kit
      </p>
    </div>
    <div class="section">
      <h2>
        Motivation
      </h2>
      <p>
        This pattern separates the details of implementation of a set of objects from their
        general usage and relies on object composition, as object creation is implemented
        in methods exposed in the factory interface.
        <br />
        <a href="http://en.wikipedia.org/wiki/Abstract_factory_pattern" target="_blank">Online resources</a>
      </p>
    </div>
    <div class="section">
      <h2>
        Applicability
      </h2>
      <p>
        <ul>
          <li>
            Use of this pattern makes it possible to interchange concrete implementations without
            changing the code that uses them, even at runtime.
          </li>
        </ul>
      </p>
    </div>
    <div class="section">
      <h2>
        Class Diagram
      </h2>
      <p>
        <img alt="Diagram" src="AbstractFactory.png" border="0" /><br/>
      </p>
    </div>
    <div class="section">
      <h2>
        Collaborations
      </h2>
      <p>
        <ul>
          <li>
            Normally a single instance of a ConcreteFactory class is created at run-time.
            <br />
                    This concrete factory creates product objects having a particular implementation.
                    To create different product objects, clients should use a different concrete factory</li>
          <li>
            AbstractFactory defers creation of product objects to its ConcreteFactory subclass.
          </li>
        </ul>
      </p>
    </div>
    <div class="section">
      <h2>
        Consequences
      </h2>
      <p>
        <ol>
          <li>
            It isolates concrete classes. The Abstract Factory pattern helps you control the
            classes of objectsthat an application creates. Because a factory encapsulates the
            responsibility and the process of creating product objects, it isolates clients
            from implementation classes. Clients manipulate instances through their abstract
            interfaces. Product class names are isolated in the implementation of the concrete
            factory and they do not appear in client code.
          </li>
          <li>
            It makes exchanging product families easy. The class of a concrete factory appears
            only once in an application—that is, where it's instantiated. This makes it easy
            to change the concrete factory an application uses. It can use different product
            configurations simply by changing the concrete factory. Because an abstract factory
            creates a complete family of products, the whole product family changes at once.
          </li>
          <li>
            It promotes consistency among products. When product objects in a family are designed
            to work together, it's important that an application use objects from only one family
            at a time.
          </li>
          <li>
            Supporting new kinds of products is difficult. Extending abstract factories to produce
            new kinds of Products isn't easy. That's because the AbstractFactory interface fixes
            the set of products that can be created. Supporting new kinds of products requires
            extending the factory interface, which involves changing the AbstractFactory class
            and all of its subclasses.
          </li>
        </ol>
      </p>
    </div>
    <div class="section">
      <h2>Related Patterns</h2>
      <p>
        <ul>
          <li><a href="">Abstract Factory</a> classes are often implemented with factory methods or using <a href="">Prototype</a><br/></li>
          <li>A concrete factory is often a <a href="">Singleton</a><br/></li>
        </ul>
      </p>
    </div>
    </div>
  </body>
</html>
